﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using InvoiceChecking.Entities;
using InvoiceChecking.Data;

#endregion

namespace InvoiceChecking.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="AllInvoiceProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class AllInvoiceProviderBaseCore : EntityViewProviderBase<AllInvoice>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;AllInvoice&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;AllInvoice&gt;"/></returns>
		protected static VList&lt;AllInvoice&gt; Fill(DataSet dataSet, VList<AllInvoice> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<AllInvoice>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;AllInvoice&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<AllInvoice>"/></returns>
		protected static VList&lt;AllInvoice&gt; Fill(DataTable dataTable, VList<AllInvoice> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					AllInvoice c = new AllInvoice();
					c.VatInvoiceNumber = (Convert.IsDBNull(row["VATInvoiceNumber"]))?string.Empty:(System.String)row["VATInvoiceNumber"];
					c.DateVisit = (Convert.IsDBNull(row["DateVisit"]))?DateTime.MinValue:(System.DateTime)row["DateVisit"];
					c.PatientCode = (Convert.IsDBNull(row["PatientCode"]))?string.Empty:(System.String)row["PatientCode"];
					c.PatientName = (Convert.IsDBNull(row["PatientName"]))?string.Empty:(System.String)row["PatientName"];
					c.PaymentMode = (Convert.IsDBNull(row["PaymentMode"]))?string.Empty:(System.String)row["PaymentMode"];
					c.UpdPaymentDate = (Convert.IsDBNull(row["UPD_PAYMENT_DATE"]))?DateTime.MinValue:(System.DateTime?)row["UPD_PAYMENT_DATE"];
					c.TotalProcedure = (Convert.IsDBNull(row["TotalProcedure"]))?0.0f:(System.Double?)row["TotalProcedure"];
					c.TotalPharmacy = (Convert.IsDBNull(row["TotalPharmacy"]))?0.0f:(System.Double?)row["TotalPharmacy"];
					c.TotalAmountVnd = (Convert.IsDBNull(row["TotalAmountVND"]))?0.0f:(System.Double?)row["TotalAmountVND"];
					c.TotalAmountUsd = (Convert.IsDBNull(row["TotalAmountUSD"]))?0.0f:(System.Double?)row["TotalAmountUSD"];
					c.ExchangeRate = (Convert.IsDBNull(row["ExchangeRate"]))?0.0f:(System.Double?)row["ExchangeRate"];
					c.SunImportDate = (Convert.IsDBNull(row["SUNImportDate"]))?DateTime.MinValue:(System.DateTime?)row["SUNImportDate"];
					c.Received = (Convert.IsDBNull(row["Received"]))?false:(System.Boolean?)row["Received"];
					c.ReturnedDate = (Convert.IsDBNull(row["ReturnedDate"]))?DateTime.MinValue:(System.DateTime?)row["ReturnedDate"];
					c.Remark = (Convert.IsDBNull(row["Remark"]))?string.Empty:(System.String)row["Remark"];
					c.ReceivedDate = (Convert.IsDBNull(row["ReceivedDate"]))?DateTime.MinValue:(System.DateTime?)row["ReceivedDate"];
					c.CompanyName = (Convert.IsDBNull(row["CompanyName"]))?string.Empty:(System.String)row["CompanyName"];
					c.PaymentModeRevised = (Convert.IsDBNull(row["PaymentModeRevised"]))?string.Empty:(System.String)row["PaymentModeRevised"];
					c.VoidType = (Convert.IsDBNull(row["VoidType"]))?string.Empty:(System.String)row["VoidType"];
					c.Returned = (Convert.IsDBNull(row["Returned"]))?false:(System.Boolean?)row["Returned"];
					c.SendDate = (Convert.IsDBNull(row["SendDate"]))?DateTime.MinValue:(System.DateTime?)row["SendDate"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;AllInvoice&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;AllInvoice&gt;"/></returns>
		protected VList<AllInvoice> Fill(IDataReader reader, VList<AllInvoice> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					AllInvoice entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<AllInvoice>("AllInvoice",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new AllInvoice();
					}
					
					entity.SuppressEntityEvents = true;

					entity.VatInvoiceNumber = (reader.IsDBNull(((int)AllInvoiceColumn.VatInvoiceNumber)))?null:(System.String)reader[((int)AllInvoiceColumn.VatInvoiceNumber)];
					//entity.VatInvoiceNumber = (Convert.IsDBNull(reader["VATInvoiceNumber"]))?string.Empty:(System.String)reader["VATInvoiceNumber"];
					entity.DateVisit = (System.DateTime)reader[((int)AllInvoiceColumn.DateVisit)];
					//entity.DateVisit = (Convert.IsDBNull(reader["DateVisit"]))?DateTime.MinValue:(System.DateTime)reader["DateVisit"];
					entity.PatientCode = (reader.IsDBNull(((int)AllInvoiceColumn.PatientCode)))?null:(System.String)reader[((int)AllInvoiceColumn.PatientCode)];
					//entity.PatientCode = (Convert.IsDBNull(reader["PatientCode"]))?string.Empty:(System.String)reader["PatientCode"];
					entity.PatientName = (reader.IsDBNull(((int)AllInvoiceColumn.PatientName)))?null:(System.String)reader[((int)AllInvoiceColumn.PatientName)];
					//entity.PatientName = (Convert.IsDBNull(reader["PatientName"]))?string.Empty:(System.String)reader["PatientName"];
					entity.PaymentMode = (reader.IsDBNull(((int)AllInvoiceColumn.PaymentMode)))?null:(System.String)reader[((int)AllInvoiceColumn.PaymentMode)];
					//entity.PaymentMode = (Convert.IsDBNull(reader["PaymentMode"]))?string.Empty:(System.String)reader["PaymentMode"];
					entity.UpdPaymentDate = (reader.IsDBNull(((int)AllInvoiceColumn.UpdPaymentDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.UpdPaymentDate)];
					//entity.UpdPaymentDate = (Convert.IsDBNull(reader["UPD_PAYMENT_DATE"]))?DateTime.MinValue:(System.DateTime?)reader["UPD_PAYMENT_DATE"];
					entity.TotalProcedure = (reader.IsDBNull(((int)AllInvoiceColumn.TotalProcedure)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalProcedure)];
					//entity.TotalProcedure = (Convert.IsDBNull(reader["TotalProcedure"]))?0.0f:(System.Double?)reader["TotalProcedure"];
					entity.TotalPharmacy = (reader.IsDBNull(((int)AllInvoiceColumn.TotalPharmacy)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalPharmacy)];
					//entity.TotalPharmacy = (Convert.IsDBNull(reader["TotalPharmacy"]))?0.0f:(System.Double?)reader["TotalPharmacy"];
					entity.TotalAmountVnd = (reader.IsDBNull(((int)AllInvoiceColumn.TotalAmountVnd)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalAmountVnd)];
					//entity.TotalAmountVnd = (Convert.IsDBNull(reader["TotalAmountVND"]))?0.0f:(System.Double?)reader["TotalAmountVND"];
					entity.TotalAmountUsd = (reader.IsDBNull(((int)AllInvoiceColumn.TotalAmountUsd)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalAmountUsd)];
					//entity.TotalAmountUsd = (Convert.IsDBNull(reader["TotalAmountUSD"]))?0.0f:(System.Double?)reader["TotalAmountUSD"];
					entity.ExchangeRate = (reader.IsDBNull(((int)AllInvoiceColumn.ExchangeRate)))?null:(System.Double?)reader[((int)AllInvoiceColumn.ExchangeRate)];
					//entity.ExchangeRate = (Convert.IsDBNull(reader["ExchangeRate"]))?0.0f:(System.Double?)reader["ExchangeRate"];
					entity.SunImportDate = (reader.IsDBNull(((int)AllInvoiceColumn.SunImportDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.SunImportDate)];
					//entity.SunImportDate = (Convert.IsDBNull(reader["SUNImportDate"]))?DateTime.MinValue:(System.DateTime?)reader["SUNImportDate"];
					entity.Received = (reader.IsDBNull(((int)AllInvoiceColumn.Received)))?null:(System.Boolean?)reader[((int)AllInvoiceColumn.Received)];
					//entity.Received = (Convert.IsDBNull(reader["Received"]))?false:(System.Boolean?)reader["Received"];
					entity.ReturnedDate = (reader.IsDBNull(((int)AllInvoiceColumn.ReturnedDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.ReturnedDate)];
					//entity.ReturnedDate = (Convert.IsDBNull(reader["ReturnedDate"]))?DateTime.MinValue:(System.DateTime?)reader["ReturnedDate"];
					entity.Remark = (reader.IsDBNull(((int)AllInvoiceColumn.Remark)))?null:(System.String)reader[((int)AllInvoiceColumn.Remark)];
					//entity.Remark = (Convert.IsDBNull(reader["Remark"]))?string.Empty:(System.String)reader["Remark"];
					entity.ReceivedDate = (reader.IsDBNull(((int)AllInvoiceColumn.ReceivedDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.ReceivedDate)];
					//entity.ReceivedDate = (Convert.IsDBNull(reader["ReceivedDate"]))?DateTime.MinValue:(System.DateTime?)reader["ReceivedDate"];
					entity.CompanyName = (reader.IsDBNull(((int)AllInvoiceColumn.CompanyName)))?null:(System.String)reader[((int)AllInvoiceColumn.CompanyName)];
					//entity.CompanyName = (Convert.IsDBNull(reader["CompanyName"]))?string.Empty:(System.String)reader["CompanyName"];
					entity.PaymentModeRevised = (System.String)reader[((int)AllInvoiceColumn.PaymentModeRevised)];
					//entity.PaymentModeRevised = (Convert.IsDBNull(reader["PaymentModeRevised"]))?string.Empty:(System.String)reader["PaymentModeRevised"];
					entity.VoidType = (reader.IsDBNull(((int)AllInvoiceColumn.VoidType)))?null:(System.String)reader[((int)AllInvoiceColumn.VoidType)];
					//entity.VoidType = (Convert.IsDBNull(reader["VoidType"]))?string.Empty:(System.String)reader["VoidType"];
					entity.Returned = (reader.IsDBNull(((int)AllInvoiceColumn.Returned)))?null:(System.Boolean?)reader[((int)AllInvoiceColumn.Returned)];
					//entity.Returned = (Convert.IsDBNull(reader["Returned"]))?false:(System.Boolean?)reader["Returned"];
					entity.SendDate = (reader.IsDBNull(((int)AllInvoiceColumn.SendDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.SendDate)];
					//entity.SendDate = (Convert.IsDBNull(reader["SendDate"]))?DateTime.MinValue:(System.DateTime?)reader["SendDate"];
					entity.AcceptChanges();
					entity.SuppressEntityEvents = false;
					
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="AllInvoice"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="AllInvoice"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, AllInvoice entity)
		{
			reader.Read();
			entity.VatInvoiceNumber = (reader.IsDBNull(((int)AllInvoiceColumn.VatInvoiceNumber)))?null:(System.String)reader[((int)AllInvoiceColumn.VatInvoiceNumber)];
			//entity.VatInvoiceNumber = (Convert.IsDBNull(reader["VATInvoiceNumber"]))?string.Empty:(System.String)reader["VATInvoiceNumber"];
			entity.DateVisit = (System.DateTime)reader[((int)AllInvoiceColumn.DateVisit)];
			//entity.DateVisit = (Convert.IsDBNull(reader["DateVisit"]))?DateTime.MinValue:(System.DateTime)reader["DateVisit"];
			entity.PatientCode = (reader.IsDBNull(((int)AllInvoiceColumn.PatientCode)))?null:(System.String)reader[((int)AllInvoiceColumn.PatientCode)];
			//entity.PatientCode = (Convert.IsDBNull(reader["PatientCode"]))?string.Empty:(System.String)reader["PatientCode"];
			entity.PatientName = (reader.IsDBNull(((int)AllInvoiceColumn.PatientName)))?null:(System.String)reader[((int)AllInvoiceColumn.PatientName)];
			//entity.PatientName = (Convert.IsDBNull(reader["PatientName"]))?string.Empty:(System.String)reader["PatientName"];
			entity.PaymentMode = (reader.IsDBNull(((int)AllInvoiceColumn.PaymentMode)))?null:(System.String)reader[((int)AllInvoiceColumn.PaymentMode)];
			//entity.PaymentMode = (Convert.IsDBNull(reader["PaymentMode"]))?string.Empty:(System.String)reader["PaymentMode"];
			entity.UpdPaymentDate = (reader.IsDBNull(((int)AllInvoiceColumn.UpdPaymentDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.UpdPaymentDate)];
			//entity.UpdPaymentDate = (Convert.IsDBNull(reader["UPD_PAYMENT_DATE"]))?DateTime.MinValue:(System.DateTime?)reader["UPD_PAYMENT_DATE"];
			entity.TotalProcedure = (reader.IsDBNull(((int)AllInvoiceColumn.TotalProcedure)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalProcedure)];
			//entity.TotalProcedure = (Convert.IsDBNull(reader["TotalProcedure"]))?0.0f:(System.Double?)reader["TotalProcedure"];
			entity.TotalPharmacy = (reader.IsDBNull(((int)AllInvoiceColumn.TotalPharmacy)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalPharmacy)];
			//entity.TotalPharmacy = (Convert.IsDBNull(reader["TotalPharmacy"]))?0.0f:(System.Double?)reader["TotalPharmacy"];
			entity.TotalAmountVnd = (reader.IsDBNull(((int)AllInvoiceColumn.TotalAmountVnd)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalAmountVnd)];
			//entity.TotalAmountVnd = (Convert.IsDBNull(reader["TotalAmountVND"]))?0.0f:(System.Double?)reader["TotalAmountVND"];
			entity.TotalAmountUsd = (reader.IsDBNull(((int)AllInvoiceColumn.TotalAmountUsd)))?null:(System.Double?)reader[((int)AllInvoiceColumn.TotalAmountUsd)];
			//entity.TotalAmountUsd = (Convert.IsDBNull(reader["TotalAmountUSD"]))?0.0f:(System.Double?)reader["TotalAmountUSD"];
			entity.ExchangeRate = (reader.IsDBNull(((int)AllInvoiceColumn.ExchangeRate)))?null:(System.Double?)reader[((int)AllInvoiceColumn.ExchangeRate)];
			//entity.ExchangeRate = (Convert.IsDBNull(reader["ExchangeRate"]))?0.0f:(System.Double?)reader["ExchangeRate"];
			entity.SunImportDate = (reader.IsDBNull(((int)AllInvoiceColumn.SunImportDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.SunImportDate)];
			//entity.SunImportDate = (Convert.IsDBNull(reader["SUNImportDate"]))?DateTime.MinValue:(System.DateTime?)reader["SUNImportDate"];
			entity.Received = (reader.IsDBNull(((int)AllInvoiceColumn.Received)))?null:(System.Boolean?)reader[((int)AllInvoiceColumn.Received)];
			//entity.Received = (Convert.IsDBNull(reader["Received"]))?false:(System.Boolean?)reader["Received"];
			entity.ReturnedDate = (reader.IsDBNull(((int)AllInvoiceColumn.ReturnedDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.ReturnedDate)];
			//entity.ReturnedDate = (Convert.IsDBNull(reader["ReturnedDate"]))?DateTime.MinValue:(System.DateTime?)reader["ReturnedDate"];
			entity.Remark = (reader.IsDBNull(((int)AllInvoiceColumn.Remark)))?null:(System.String)reader[((int)AllInvoiceColumn.Remark)];
			//entity.Remark = (Convert.IsDBNull(reader["Remark"]))?string.Empty:(System.String)reader["Remark"];
			entity.ReceivedDate = (reader.IsDBNull(((int)AllInvoiceColumn.ReceivedDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.ReceivedDate)];
			//entity.ReceivedDate = (Convert.IsDBNull(reader["ReceivedDate"]))?DateTime.MinValue:(System.DateTime?)reader["ReceivedDate"];
			entity.CompanyName = (reader.IsDBNull(((int)AllInvoiceColumn.CompanyName)))?null:(System.String)reader[((int)AllInvoiceColumn.CompanyName)];
			//entity.CompanyName = (Convert.IsDBNull(reader["CompanyName"]))?string.Empty:(System.String)reader["CompanyName"];
			entity.PaymentModeRevised = (System.String)reader[((int)AllInvoiceColumn.PaymentModeRevised)];
			//entity.PaymentModeRevised = (Convert.IsDBNull(reader["PaymentModeRevised"]))?string.Empty:(System.String)reader["PaymentModeRevised"];
			entity.VoidType = (reader.IsDBNull(((int)AllInvoiceColumn.VoidType)))?null:(System.String)reader[((int)AllInvoiceColumn.VoidType)];
			//entity.VoidType = (Convert.IsDBNull(reader["VoidType"]))?string.Empty:(System.String)reader["VoidType"];
			entity.Returned = (reader.IsDBNull(((int)AllInvoiceColumn.Returned)))?null:(System.Boolean?)reader[((int)AllInvoiceColumn.Returned)];
			//entity.Returned = (Convert.IsDBNull(reader["Returned"]))?false:(System.Boolean?)reader["Returned"];
			entity.SendDate = (reader.IsDBNull(((int)AllInvoiceColumn.SendDate)))?null:(System.DateTime?)reader[((int)AllInvoiceColumn.SendDate)];
			//entity.SendDate = (Convert.IsDBNull(reader["SendDate"]))?DateTime.MinValue:(System.DateTime?)reader["SendDate"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="AllInvoice"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="AllInvoice"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, AllInvoice entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.VatInvoiceNumber = (Convert.IsDBNull(dataRow["VATInvoiceNumber"]))?string.Empty:(System.String)dataRow["VATInvoiceNumber"];
			entity.DateVisit = (Convert.IsDBNull(dataRow["DateVisit"]))?DateTime.MinValue:(System.DateTime)dataRow["DateVisit"];
			entity.PatientCode = (Convert.IsDBNull(dataRow["PatientCode"]))?string.Empty:(System.String)dataRow["PatientCode"];
			entity.PatientName = (Convert.IsDBNull(dataRow["PatientName"]))?string.Empty:(System.String)dataRow["PatientName"];
			entity.PaymentMode = (Convert.IsDBNull(dataRow["PaymentMode"]))?string.Empty:(System.String)dataRow["PaymentMode"];
			entity.UpdPaymentDate = (Convert.IsDBNull(dataRow["UPD_PAYMENT_DATE"]))?DateTime.MinValue:(System.DateTime?)dataRow["UPD_PAYMENT_DATE"];
			entity.TotalProcedure = (Convert.IsDBNull(dataRow["TotalProcedure"]))?0.0f:(System.Double?)dataRow["TotalProcedure"];
			entity.TotalPharmacy = (Convert.IsDBNull(dataRow["TotalPharmacy"]))?0.0f:(System.Double?)dataRow["TotalPharmacy"];
			entity.TotalAmountVnd = (Convert.IsDBNull(dataRow["TotalAmountVND"]))?0.0f:(System.Double?)dataRow["TotalAmountVND"];
			entity.TotalAmountUsd = (Convert.IsDBNull(dataRow["TotalAmountUSD"]))?0.0f:(System.Double?)dataRow["TotalAmountUSD"];
			entity.ExchangeRate = (Convert.IsDBNull(dataRow["ExchangeRate"]))?0.0f:(System.Double?)dataRow["ExchangeRate"];
			entity.SunImportDate = (Convert.IsDBNull(dataRow["SUNImportDate"]))?DateTime.MinValue:(System.DateTime?)dataRow["SUNImportDate"];
			entity.Received = (Convert.IsDBNull(dataRow["Received"]))?false:(System.Boolean?)dataRow["Received"];
			entity.ReturnedDate = (Convert.IsDBNull(dataRow["ReturnedDate"]))?DateTime.MinValue:(System.DateTime?)dataRow["ReturnedDate"];
			entity.Remark = (Convert.IsDBNull(dataRow["Remark"]))?string.Empty:(System.String)dataRow["Remark"];
			entity.ReceivedDate = (Convert.IsDBNull(dataRow["ReceivedDate"]))?DateTime.MinValue:(System.DateTime?)dataRow["ReceivedDate"];
			entity.CompanyName = (Convert.IsDBNull(dataRow["CompanyName"]))?string.Empty:(System.String)dataRow["CompanyName"];
			entity.PaymentModeRevised = (Convert.IsDBNull(dataRow["PaymentModeRevised"]))?string.Empty:(System.String)dataRow["PaymentModeRevised"];
			entity.VoidType = (Convert.IsDBNull(dataRow["VoidType"]))?string.Empty:(System.String)dataRow["VoidType"];
			entity.Returned = (Convert.IsDBNull(dataRow["Returned"]))?false:(System.Boolean?)dataRow["Returned"];
			entity.SendDate = (Convert.IsDBNull(dataRow["SendDate"]))?DateTime.MinValue:(System.DateTime?)dataRow["SendDate"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region AllInvoiceFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="AllInvoice"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class AllInvoiceFilterBuilder : SqlFilterBuilder<AllInvoiceColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the AllInvoiceFilterBuilder class.
		/// </summary>
		public AllInvoiceFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the AllInvoiceFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public AllInvoiceFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the AllInvoiceFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public AllInvoiceFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion AllInvoiceFilterBuilder

	#region AllInvoiceParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="AllInvoice"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class AllInvoiceParameterBuilder : ParameterizedSqlFilterBuilder<AllInvoiceColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the AllInvoiceParameterBuilder class.
		/// </summary>
		public AllInvoiceParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the AllInvoiceParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public AllInvoiceParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the AllInvoiceParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public AllInvoiceParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion AllInvoiceParameterBuilder
	
	#region AllInvoiceSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="AllInvoice"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class AllInvoiceSortBuilder : SqlSortBuilder<AllInvoiceColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the AllInvoiceSqlSortBuilder class.
		/// </summary>
		public AllInvoiceSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion AllInvoiceSortBuilder

} // end namespace
